//package com.mine.eureka.controllers;
//
//import org.apache.rocketmq.client.consumer.DefaultMQPushConsumer;
//import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyContext;
//import org.apache.rocketmq.client.consumer.listener.ConsumeConcurrentlyStatus;
//import org.apache.rocketmq.client.consumer.listener.MessageListenerConcurrently;
//import org.apache.rocketmq.client.exception.MQClientException;
//import org.apache.rocketmq.common.message.MessageExt;
//import org.apache.rocketmq.common.protocol.heartbeat.MessageModel;
//
//import java.util.List;
//
//public class test {
//    public static void main(String[] args) throws MQClientException {
//        //创建一个push模式的消费组
//        DefaultMQPushConsumer pushConsumer = new DefaultMQPushConsumer("herostory");
//        pushConsumer.setNamesrvAddr("localhost:9876;localhost:9877");
//        //集群模式
//        pushConsumer.setMessageModel(MessageModel.CLUSTERING);
//        //  订阅的topic tag
//        pushConsumer.subscribe("herostory_victor","*");
//
//        pushConsumer.registerMessageListener(new MessageListenerConcurrently() {
//            @Override
//            public ConsumeConcurrentlyStatus consumeMessage(List<MessageExt> msgs, ConsumeConcurrentlyContext context) {
//                System.out.printf(Thread.currentThread().getName() + " Receive New Messages: " + msgs + "%n");
//                return ConsumeConcurrentlyStatus.CONSUME_SUCCESS;
//            }
//        });
//        pushConsumer.start();
//        System.out.printf("Broadcast Consumer Started.%n");
//
//    }
//}
